home *** CD-ROM | disk | FTP | other *** search
/ Visual Basic Source Code / Visual Basic Source Code.iso / vbsource / acompl1a / frmmain.frm (.txt) < prev    next >
Encoding:
Visual Basic Form  |  1999-10-13  |  5.1 KB  |  128 lines

  1. VERSION 5.00
  2. Begin VB.Form FrmMain 
  3.    BorderStyle     =   0  'None
  4.    Caption         =   "Form1"
  5.    ClientHeight    =   9000
  6.    ClientLeft      =   0
  7.    ClientTop       =   0
  8.    ClientWidth     =   12000
  9.    LinkTopic       =   "Form1"
  10.    ScaleHeight     =   600
  11.    ScaleMode       =   3  'Pixel
  12.    ScaleWidth      =   800
  13.    ShowInTaskbar   =   0   'False
  14.    Begin VB.Timer Timer1 
  15.       Interval        =   1
  16.       Left            =   2520
  17.       Top             =   1920
  18.    End
  19.    Begin VB.Label lblCredits 
  20.       Alignment       =   2  'Center
  21.       AutoSize        =   -1  'True
  22.       BackStyle       =   0  'Transparent
  23.       Caption         =   "Label1"
  24.       BeginProperty Font 
  25.          Name            =   "MS Sans Serif"
  26.          Size            =   12
  27.          Charset         =   0
  28.          Weight          =   700
  29.          Underline       =   0   'False
  30.          Italic          =   0   'False
  31.          Strikethrough   =   0   'False
  32.       EndProperty
  33.       ForeColor       =   &H00FFFFFF&
  34.       Height          =   300
  35.       Index           =   0
  36.       Left            =   2580
  37.       TabIndex        =   0
  38.       Top             =   840
  39.       Width           =   855
  40.    End
  41. Attribute VB_Name = "FrmMain"
  42. Attribute VB_GlobalNameSpace = False
  43. Attribute VB_Creatable = False
  44. Attribute VB_PredeclaredId = True
  45. Attribute VB_Exposed = False
  46. Private Sub Form_Load()
  47. ' Get information
  48.     Open "c:\Windows\Control.ini" For Input As #1
  49.     INIFound = False
  50.     'This is the same as form_load on frmconfig
  51.     Do While Not EOF(1)
  52.         Line Input #1, temp 'Read Data
  53.         If temp = "[Screen Saver.CarlsCredits]" Then 'If settings found
  54.             INIFound = True
  55.             
  56.             '10 lines to read
  57.             For i = 0 To 6
  58.                 Line Input #1, CreditText(i) 'Get text
  59.             Next i
  60.             Line Input #1, temp 'Get colors
  61.             Colo.R = Val(temp)
  62.             Line Input #1, temp
  63.             Colo.G = Val(temp)
  64.             Line Input #1, temp
  65.             Colo.B = Val(temp)
  66.             
  67.             Exit Do 'Exit DO-LOOP when settings are found
  68.         End If
  69.     Loop
  70.     Close #1
  71. ' If settings isn't found
  72. If INIFound = False Then
  73.     CreditText(0) = "Carls" 'Use Default Values
  74.     CreditText(1) = "Scrolling Credits" 'Use Default Values
  75.     CreditText(2) = "Screen Saver" 'Use Default Values
  76.     CreditText(3) = "For a free game made in VB visit" 'Use Default Values
  77.     CreditText(4) = "http://www.parkstonemot.freeserve.co.uk" 'Use Default Values
  78.     CreditText(5) = "For Motocross visit" 'Use Default Values
  79.     CreditText(6) = "http://www.dirtrider.net/freeride" 'Use Default Values
  80.     Colo.R = 255 'Use Default Values
  81.     Colo.G = 125 'Use Default Values
  82.     Colo.B = 80 'Use Default Values
  83. End If
  84. ' Set background to black
  85. FrmMain.BackColor = RGB(0, 0, 0)
  86. lblCredits(0).Top = FrmMain.ScaleHeight 'Set first label just out of sight
  87. lblCredits(0).Left = (FrmMain.ScaleWidth / 2) - (lblCredits(0).Width / 2) 'Centre first label
  88. For i = 1 To NumLines
  89.     Load lblCredits(i) 'Create new labels
  90.     lblCredits(i).Top = lblCredits(i - 1).Top + lblCredits(i - 1).Height        'Set labels vertical position
  91.     lblCredits(i).Left = (FrmMain.ScaleWidth / 2) - (lblCredits(i).Width / 2)   'Centre label
  92.     lblCredits(i).Visible = True    'Show label
  93. Next i
  94. For i = 0 To NumLines
  95.     lblCredits(i).Caption = CreditText(i)   'Set labels Text
  96. Next i
  97. End Sub
  98. 'End if mouse or key is pressed
  99. Private Sub Form_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
  100. End Sub
  101. Private Sub Form_KeyDown(KeyCode As Integer, Shift As Integer)
  102. End Sub
  103. 'Not used in the screen saver, but sets the labels to their
  104. 'correct positions if screen is resized.
  105. Private Sub Form_Resize()
  106. lblCredits(0).Top = FrmMain.ScaleHeight
  107. lblCredits(0).Left = (FrmMain.ScaleWidth / 2) - (lblCredits(0).Width / 2)
  108. For i = 1 To NumLines
  109.     lblCredits(i).Top = lblCredits(i - 1).Top + lblCredits(i - 1).Height
  110.     lblCredits(i).Left = (FrmMain.ScaleWidth / 2) - (lblCredits(i).Width / 2)
  111. Next i
  112. End Sub
  113. Private Sub Timer1_Timer()
  114. For i = 0 To NumLines
  115.     'Check if label is out of the top
  116.     If lblCredits(i).Top <= -lblCredits(i).Height Then lblCredits(i).Top = FrmMain.ScaleHeight
  117.     'Sets the color for the text
  118.     If lblCredits(i).Top <= FrmMain.ScaleHeight And lblCredits(i).Top >= FrmMain.ScaleHeight / 2 Then
  119.         lblCredits(i).ForeColor = RGB(((FrmMain.ScaleHeight - lblCredits(i).Top) / (FrmMain.ScaleHeight / 2)) * Colo.R, ((FrmMain.ScaleHeight - lblCredits(i).Top) / (FrmMain.ScaleHeight / 2)) * Colo.G, ((FrmMain.ScaleHeight - lblCredits(i).Top) / (FrmMain.ScaleHeight / 2)) * Colo.B)
  120.     End If
  121.     If lblCredits(i).Top <= FrmMain.ScaleHeight / 2 And lblCredits(i).Top >= 0 Then
  122.         lblCredits(i).ForeColor = RGB((lblCredits(i).Top) / (FrmMain.ScaleHeight / 2) * Colo.R, (lblCredits(i).Top) / (FrmMain.ScaleHeight / 2) * Colo.G, (lblCredits(i).Top) / (FrmMain.ScaleHeight / 2) * Colo.B)
  123.     End If
  124.     'Moves the label up
  125.     lblCredits(i).Top = lblCredits(i).Top - 3
  126. Next i
  127. End Sub
  128.